
(** calculate number of photo electrons *)
let nphe ~mean ~sigma mu =
    let ch_n = sigma**2. /. mean in
    let n_phe = mu /. ch_n in
    ch_n, n_phe 
;;

module List = struct
    let multiplicity (f: 'a -> bool) (l: 'a list) =
        List.fold_left (fun sum a -> if f a then sum+1 else sum) 0 l
end

module Array = struct
    let multiplicity (f: 'a -> bool) (l: 'a array) =
(*    let multiplicity f l =*)
        Array.fold_left (fun sum a -> if f a then sum+1 else sum) 0 l
end


